<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ include file="/pub/includ.jsp"%>
<html>
	<head>
		<script type="text/javascript">
		
			$(function(){
				//加载两个要使用json分页的组�?
		        loadGird("frm", 1);
			})
				
			var callback_frm = function(rows, frm) {
		       $.each(rows, function(i, n){
		    	   var row = $("#"+frm+" .template").clone().removeClass("template");
		   			       var keyValue = n.id;
			       row.find(".klId").attr("value",n.id);
			   	
			       row.find(".kllogin_name").text(n.login_name);
			   	
			       row.find(".klemail").text(n.email);
			   	
			       row.find(".klmobile").text(n.mobile);
			   	
			       row.find(".klphone").text(n.phone);
			   	
			       row.find(".klname").text(n.name);
			   	
			       row.find(".klsex").text(n.sex);
			   	
			       row.find(".klold").text(n.old);
			   	
		 		   row.attr("id","ready"+i);
		           row.attr("class","tr_nbw");
		           row.appendTo("#"+frm+" .grid");
		       });   
			}
			
			var delsite_users = function(){
				var options = {
				type: 'POST',
				async: false,
				dataType: 'content-type',
				success: function(msg) {
					alert("成功删除"+msg+"条记录！");
					document.location.reload();
				}
				}
				if(confirm('您确认要删除吗？')){
					document.getElementById("frm").action="<%=path%>/ext/site_user/delsite_users";
					$('#frm').ajaxSubmit(options);
				}
			}
			function addsite_user(){
	            opendailog("{src:'<%=path %>/ext/site_user/toForm/0',title:'网站用户属性',width:400,height:350,savefunc:'savefunc'}",window);
			}
			
			function modifysite_user(id){
				if(checkOnlySel()){
		            opendailog("{src:'<%=path %>/ext/site_user/toForm/"+getCheckedObj("chk")[0].value+"',title:'网站用户属性',width:400,height:350,savefunc:'savefunc'}",window);
				}
			}
			
			function savefunc(frame){
				var retv = frame.contentWindow.save()
				if(retv=="success"){
					alertMsg("保存成功!");
					reloadGrid("frm", 1);
				}
				return retv;
			}
		</script>
	</head>
<body>
<form name="frm" method="post" style="margin: 0" action="<%=path%>/ext/site_user/list" id="frm">
		<table width="100%">
			<tr>
				<td height="2px"></td>
			</tr>
			<tr><td align="right">
				<input type="button" onclick="addsite_user();" class="button4_nbw" value="添加" />
				<input type="button" onclick="modifysite_user();" class="button4_nbw" value="修改" />
				<input type="button" onclick="delsite_users()" class="button4_nbw" value="删除" />
				&nbsp;&nbsp;
				</td>
			</tr>
		</table>
		<center>
		<table><tr><td height="2px"></td></tr></table>
		<table border="0" cellspacing="1" cellpadding="0" class="table_nbw  niceTable grid">
			<thead class="th_nbw">
				<tr >
					<td width="40px" >
						<input type="checkbox" class="allCheck" />
					</td>
		      		<td>
						帐号
					</td>    
		      		<td>
						姓名
					</td>  
		      		<td>
						性别
					</td> 
		      		<td>
						年龄
					</td>   
		      		<td>
						Email
					</td>   
		      		<td>
						手机
					</td>   
		      		<td>
						电话
					</td>     
				</tr>
			</thead>
			<tbody>
				<tr class="template klId">
					<td width="40px" class="idCheck">
						<input type="checkbox" name="chk" class="klId" />
					</td>
		   		    <td class="kllogin_name niceTable-left"></td>
		   		    <td class="klname niceTable-left"></td>
		   		    <td class="klsex niceTable-left"></td>
		   		    <td class="klold niceTable-left"></td>
		   		    <td class="klemail niceTable-left"></td>
		   		    <td class="klmobile niceTable-left"></td>
		   		    <td class="klphone niceTable-left"></td>
				</tr>
			</tbody>
			<tfoot>
				<tr>
					<td style="border-right: none">
						<img 
							src="<%=path %>/resources/skins/default/images/large-loading.gif" width="20px"
							class="hidden loading" />
					</td>
					<td colspan="8" style="border-left: none" class="txtRight">
						<span class="pagediv"></span>
					</td>
				</tr>
			</tfoot>
		</table>
		</center>
	</form>
</body>
</html>
